using SheLife.Domain.Entities;

namespace SheLife.Application.Interfaces;

public interface IDietRecordService
{
    Task<DietRecord?> GetDietRecordByIdAsync(Guid id);
    Task<IEnumerable<DietRecord>> GetDietRecordsByUserIdAsync(Guid userId);
    Task<IEnumerable<DietRecord>> GetDietRecordsByUserIdAndDateRangeAsync(Guid userId, DateTime startDate, DateTime endDate);
    Task<IEnumerable<DietRecord>> GetDietRecordsByUserIdAndMealTypeAsync(Guid userId, string mealType);
    Task<DietRecord> CreateDietRecordAsync(Guid userId, DateTime date, string mealType, string description, decimal calories, string? notes = null);
    Task<DietRecord?> UpdateDietRecordAsync(Guid id, DateTime? date, string? mealType, string? description, decimal? calories, string? notes = null);
    Task<bool> DeleteDietRecordAsync(Guid id);
    Task<Dictionary<string, decimal>> GetDietStatisticsAsync(Guid userId, int days = 7);
}

public interface IDietNutrientService
{
    Task<DietNutrient?> GetDietNutrientByIdAsync(Guid id);
    Task<IEnumerable<DietNutrient>> GetDietNutrientsByDietRecordIdAsync(Guid dietRecordId);
    Task<IEnumerable<DietNutrient>> GetDietNutrientsByUserIdAndDateRangeAsync(Guid userId, DateTime startDate, DateTime endDate);
    Task<DietNutrient> CreateDietNutrientAsync(Guid dietRecordId, string nutrientName, decimal amount, string unit);
    Task<DietNutrient?> UpdateDietNutrientAsync(Guid id, string? nutrientName, decimal? amount, string? unit);
    Task<bool> DeleteDietNutrientAsync(Guid id);
    Task<Dictionary<string, decimal>> GetNutrientStatisticsAsync(Guid userId, int days = 7);
}

public interface IRecipeService
{
    Task<Recipe?> GetRecipeByIdAsync(Guid id);
    Task<IEnumerable<Recipe>> GetAllRecipesAsync();
    Task<IEnumerable<Recipe>> GetRecipesByCategoryAsync(string category);
    Task<IEnumerable<Recipe>> GetRecipesByTagAsync(string tag);
    Task<IEnumerable<Recipe>> SearchRecipesAsync(string keyword);
    Task<Recipe> CreateRecipeAsync(string name, string description, string category, List<string> tags, int prepTime, int cookTime, int servings, decimal calories, string? imageUrl = null);
    Task<Recipe?> UpdateRecipeAsync(Guid id, string? name, string? description, string? category, List<string>? tags, int? prepTime, int? cookTime, int? servings, decimal? calories, string? imageUrl = null);
    Task<bool> DeleteRecipeAsync(Guid id);
}

public interface IRecipeIngredientService
{
    Task<RecipeIngredient?> GetRecipeIngredientByIdAsync(Guid id);
    Task<IEnumerable<RecipeIngredient>> GetRecipeIngredientsByRecipeIdAsync(Guid recipeId);
    Task<RecipeIngredient> CreateRecipeIngredientAsync(Guid recipeId, string name, decimal amount, string unit);
    Task<RecipeIngredient?> UpdateRecipeIngredientAsync(Guid id, string? name, decimal? amount, string? unit);
    Task<bool> DeleteRecipeIngredientAsync(Guid id);
}

public interface IRecipeStepService
{
    Task<RecipeStep?> GetRecipeStepByIdAsync(Guid id);
    Task<IEnumerable<RecipeStep>> GetRecipeStepsByRecipeIdAsync(Guid recipeId);
    Task<RecipeStep> CreateRecipeStepAsync(Guid recipeId, int stepNumber, string description, string? imageUrl = null);
    Task<RecipeStep?> UpdateRecipeStepAsync(Guid id, int? stepNumber, string? description, string? imageUrl = null);
    Task<bool> DeleteRecipeStepAsync(Guid id);
}

public interface IRecipeNutrientService
{
    Task<RecipeNutrient?> GetRecipeNutrientByIdAsync(Guid id);
    Task<IEnumerable<RecipeNutrient>> GetRecipeNutrientsByRecipeIdAsync(Guid recipeId);
    Task<RecipeNutrient> CreateRecipeNutrientAsync(Guid recipeId, string nutrientName, decimal amount, string unit);
    Task<RecipeNutrient?> UpdateRecipeNutrientAsync(Guid id, string? nutrientName, decimal? amount, string? unit);
    Task<bool> DeleteRecipeNutrientAsync(Guid id);
}

public interface IUserRecipeService
{
    Task<UserRecipe?> GetUserRecipeByIdAsync(Guid id);
    Task<IEnumerable<UserRecipe>> GetUserRecipesByUserIdAsync(Guid userId);
    Task<IEnumerable<UserRecipe>> GetUserRecipesByUserIdAndRecipeIdAsync(Guid userId, Guid recipeId);
    Task<UserRecipe> CreateUserRecipeAsync(Guid userId, Guid recipeId, string? notes = null);
    Task<UserRecipe?> UpdateUserRecipeAsync(Guid id, string? notes);
    Task<bool> DeleteUserRecipeAsync(Guid id);
    Task<bool> IsUserFavoriteRecipeAsync(Guid userId, Guid recipeId);
}